<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>怡臣 | 店铺管理</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="/Public/admin/adminlte/bootstrap/css/bootstrap.min.css">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="/Public/admin/adminlte/plugins/font-awesome/font-awesome.min.css">
    <!-- Ionicons -->
    <!--link rel="stylesheet" href="/Public/admin/adminlte/plugins/ionicons/ionicons.min.css"-->
    <!-- Theme style -->
    <link rel="stylesheet" href="/Public/admin/adminlte/dist/css/AdminLTE.min.css">
    <!-- AdminLTE Skins. Choose a skin from the css/skins
         folder instead of downloading all of them to reduce the load. -->
    <link rel="stylesheet" href="/Public/admin/adminlte/dist/css/skins/_all-skins.min.css">
    <!-- iCheck -->
    <link rel="stylesheet" href="/Public/admin/adminlte/plugins/iCheck/flat/blue.css">
    <!-- Morris chart -->
    <link rel="stylesheet" href="/Public/admin/adminlte/plugins/morris/morris.css">
    <!-- jvectormap -->
    <link rel="stylesheet" href="/Public/admin/adminlte/plugins/jvectormap/jquery-jvectormap-1.2.2.css">
    <!-- Date Picker -->
    <link rel="stylesheet" href="/Public/admin/adminlte/plugins/datepicker/datepicker3.css">
    <!-- Daterange picker -->
    <link rel="stylesheet" href="/Public/admin/adminlte/plugins/daterangepicker/daterangepicker.css">
    <!-- bootstrap wysihtml5 - text editor -->
    <link rel="stylesheet" href="/Public/admin/adminlte/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css">
    <!-- jQuery 2.2.3 -->
    <script src="/Public/admin/adminlte/plugins/jQuery/jquery-2.2.3.min.js"></script>
    <!-- jQuery UI 1.11.4 -->
    <script src="/Public/admin/adminlte/bootstrap/js/jquery-ui.min.js"></script>

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="/Public/admin/adminlte/plugins/html5shiv/html5shiv.min.js"></script>
    <script src="/Public/admin/adminlte/plugins/html5shiv/respond.min.js"></script>
    <![endif]-->
</head>
<body class="hold-transition skin-blue sidebar-mini">

<!-- 内容页 -->
<div class="">
    <!-- 面包屑 -->
    <section class="content-header">
        <h1>
            页面
            <small>管理</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="/admin/cacousel/index"><i class="fa fa-dashboard"></i> 页面管理</a></li>
            <li><a href="/admin/cacousel/index"><i class="fa fa-dashboard"></i> 首页轮播</a></li>
            <li class="active">新增产品列表</li>
        </ol>
    </section>

    <!-- 内容 -->
    <section class="content">
        <div class="row">
            <div class="col-md-12">
                <div class="box">
                    <div class="box-header">
                        <h3 class="box-title"></h3>


                        <div class="form-inline pull-right">
                            <form action="" method="get">
                                <fieldset>
                                    <div class="input-group input-group-sm">
                                        <span class="input-group-addon"><strong>货品名称</strong></span>
                                        <input type="text" class="form-control" placeholder="货品名称" name="name" value="">
                                    </div>

                                    <div class="input-group input-group-sm">
                                        <div class="input-group-btn">
                                            <button type="submit" class="btn btn-primary"><i class="fa fa-search"></i>
                                            </button>
                                        </div>
                                    </div>

                                </fieldset>
                            </form>
                        </div>

                    </div>
                    <!-- /.box-header -->
                    <div class="box-body table-responsive no-padding">
                        <table class="table table-hover">
                            <tbody>

                            <tr>
                                <th><input type="checkbox" class="grid-select-all"></th>
                                <th>ID</th>
                                <th>货品名称</th>
                                <th>图片</th>
                                <th>货品描述</th>
                                <th>店铺市场价</th>
                                <th>店铺销售价</th>
                                <th>店铺库存</th>
                                <th>折后价</th>
                                <th>冻结库存</th>
                            </tr>
                            <foreach name="product_relation_msg" item="v">
                                <tr>
                                    <td><input type="checkbox" class="grid-item" data-id="{$v.store_pid}"  <if condition="in_array($v['store_pid'],$value)">checked</if> ></td>
                                    <td>{$v.store_pid}</td>
                                    <td>{$v.name}</td>
                                    <td><img src="{:getThumb($v['goods_id'])}" style="width: 100px" /></td>
                                    <td>{$v.spec_info}</td>
                                    <td>{$v.marketprice}</td>
                                    <td>{$v.price}</td>
                                    <td>{$v.store}</td>
                                    <td>{$v.discount}</td>
                                    <td>{$v.freez}</td>

                                </tr>
                            </foreach>
                            </tbody>
                        </table>
                    </div>
                    <div class="box-footer clearfix">
                        <input type="checkbox" class="grid-select-all">&nbsp;&nbsp;&nbsp;
                        <a class="btn btn-sm btn-info add-goods">保存</a>
                        {$show}


                    </div>

                    <!-- /.box-body -->
                </div>
            </div>
        </div>

    </section>
</div>
</body>
<script>

    $(function () {

        $('.delete').click(function () {
            if(!confirm("确定删除？"))
            {
                return false;
            }
        })
    })

</script>
<script src="/Public/layer/layer.js"></script>
<script data-exec-on-popstate>

    $(function () {


        $('.grid-select-all').change(function () {
            if (this.checked) {
                $('.grid-item').prop("checked", true);
            } else {
                $('.grid-item').prop("checked", false);
            }
        });

        $('.add-goods').on('click', function () {
            var selected = [];

            $('.grid-item').each(function () {
                var id = $(this).data('id');

                if ($(this).is(':checked')) {
                    var goods_values = id + '-1';
                    selected.push(goods_values);
                } else {
                    var goods_values = id + '-0';
                    selected.push(goods_values);
                }
            });
            if (selected.length == 0) {
                return;
            }
            $.post('/admin/carousel/productSave/id/{$id}', {data: selected}, function (data) {
//                window.location.reload();
                parent.layer.close(parent.layer.getFrameIndex(window.name));
            });
        });
    });
</script>

